package org.piwicode.bywordofmouth.net;

import com.google.common.base.Preconditions;
import com.google.inject.internal.Nullable;
import java.io.Serializable;

/**
 *
 * @author pierre
 */
class ServiceRequest implements Serializable {

    private final String methodName;
    @Nullable
    private final Object[] args;

    ServiceRequest(String methodName, @Nullable Object[] args) {
        this.methodName = Preconditions.checkNotNull(methodName);
        this.args = args;
    }

    Object call(Service service) throws ReflectiveOperationException {
        return service.call(methodName, args);
    }
}
